package TestCTR;

import java.util.ArrayList;

import org.junit.Test;

import CTRLayer.TrainedCTR;
import CTRLayer.TrainingDayCTR;
import ModelLayer.Trained;
import ModelLayer.TrainingDay;

public class TestTrainingDayCTR
{
	private TrainingDayCTR tdc = new TrainingDayCTR();
	private TrainingDay td = new TrainingDay();
	private TrainedCTR tc = new TrainedCTR();

	@Test
	public void testFindAllTrainingDay()
	{
		ArrayList<TrainingDay> tdlist = tdc.findAllTrainingDay();
		int id = 0;
		System.out.println("\nElementer i TrainingDay : " + tdlist.size() + "\n");
		while (id < tdlist.size())
		{
			System.out.println("TrainingDayID        : " + tdlist.get(id).getTrainingDayID());
			System.out.println("PMDate               : " + tdlist.get(id).getDate());
			System.out.println("TrainingStart        : " + tdlist.get(id).getTrainingStart());
			System.out.println("TrainingEnd          : " + tdlist.get(id).getTrainingEnd());
			System.out.println("Intensity            : " + tdlist.get(id).getIntensity());
			System.out.println("Trainer ID           : " + tdlist.get(id).getTrainer().getTrainerID());
			System.out.println("Trainer FName        : " + tdlist.get(id).getTrainer().getfName());
			System.out.println("Trainer LName        : " + tdlist.get(id).getTrainer().getlName());
			System.out.println("Child ID             : " + tdlist.get(id).getChild().getChildID());
			System.out.println("Child CPR            : " + tdlist.get(id).getChild().getCPR());
			System.out.println("Child FName          : " + tdlist.get(id).getChild().getfName());
			System.out.println("Child LName          : " + tdlist.get(id).getChild().getlName());
			System.out.println("TrainingProgramID    : " + tdlist.get(id).getTrainingProgram().getTrainingProgramID());
			System.out.println("TrainingProgramName  : " + tdlist.get(id).getTrainingProgram().getName());
			System.out.println("----------------------------------------");
			id++;
		}
	}
	
	@Test
	public void testfindTrainingDayID()
	{
		int id = 1;
		td = tdc.findTrainingDayID(id);
		System.out.println("TrainingDayID        : " + td.getTrainingDayID());
		System.out.println("PMDate               : " + td.getDate());
		System.out.println("TrainingStart        : " + td.getTrainingStart());
		System.out.println("TrainingEnd          : " + td.getTrainingEnd());
		System.out.println("Intensity            : " + td.getIntensity());
		System.out.println("Trainer ID           : " + td.getTrainer().getTrainerID());
		System.out.println("Trainer FName        : " + td.getTrainer().getfName());
		System.out.println("Trainer LName        : " + td.getTrainer().getlName());
		System.out.println("Child ID             : " + td.getChild().getChildID());
		System.out.println("Child CPR            : " + td.getChild().getCPR());
		System.out.println("Child FName          : " + td.getChild().getfName());
		System.out.println("Child LName          : " + td.getChild().getlName());
		System.out.println("TrainingProgramID    : " + td.getTrainingProgram().getTrainingProgramID());
		System.out.println("TrainingProgramName  : " + td.getTrainingProgram().getName());
		System.out.println("----------------------------------------");
		
		ArrayList<Trained> trlist = tc.findAllTrainedByTrainingDayID(id);
		for(Trained trained : trlist)
		{
			System.out.println("Aktivitet til " + id + ": " + trained.getName());
			System.out.println("----------------------------------------");
		}
	}
	
	@Test
	public void findTrainingDayDate()
	{
		String date = "2012-05-30";
		td = tdc.findTrainingDayDate(date);
		System.out.println("TrainingDayID        : " + td.getTrainingDayID());
		System.out.println("PMDate               : " + td.getDate());
		System.out.println("TrainingStart        : " + td.getTrainingStart());
		System.out.println("TrainingEnd          : " + td.getTrainingEnd());
		System.out.println("Intensity            : " + td.getIntensity());
		System.out.println("Trainer ID           : " + td.getTrainer().getTrainerID());
		System.out.println("Trainer FName        : " + td.getTrainer().getfName());
		System.out.println("Trainer LName        : " + td.getTrainer().getlName());
		System.out.println("Child ID             : " + td.getChild().getChildID());
		System.out.println("Child CPR            : " + td.getChild().getCPR());
		System.out.println("Child FName          : " + td.getChild().getfName());
		System.out.println("Child LName          : " + td.getChild().getlName());
		System.out.println("TrainingProgramID    : " + td.getTrainingProgram().getTrainingProgramID());
		System.out.println("TrainingProgramName  : " + td.getTrainingProgram().getName());
		System.out.println("----------------------------------------");
	}
}
